import 'package:enterprise_v6_app/app/components/custom_modele/custom_tree.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/modules/task/task_all/process_execution/process_execution_controller.dart';
import 'package:enterprise_v6_app/router/app_pages.dart';

/// 流程执行模块
class ProcessExecutionPage extends StatelessWidget {
  ProcessExecutionPage({super.key});

  final controller = Get.put(ProcessExecutionController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
      init: controller,
      builder: (_) {
        return CustomTreeBuilder(
          data: controller.tree,
          onSelected: (p0) {
            Get.toNamed(AppRoutes.myTaskProcessApprovalDetail, arguments: p0);
          },
          borderBuilder: (p0) {
            if (p0.treeId != controller.selectedId) return null;
            return const Border(
              right: BorderSide(
                color: Colors.blue,
                width: 2,
              ),
            );
          },
          backgroundColorBuilder: (p0) => Colors.blue.withOpacity(0.1),
        );
      },
    );
  }
}
